package com.ys.utils.kd;

import com.ys.utils.base.j2se.HttpUtils;
import com.ys.utils.spring.config.SystemError;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class Kd100Handler {

    public static final String APPKEY = "f3534cc543a8b8c9";// 你的appkey
    public static final String URL = "https://api.jisuapi.com/express/query";
    public static final String type = "auto";

    public static Kd100Info Get(String number,String mobile) {
        String result = null;
        String url = URL + "?appkey=" + APPKEY + "&type=" + type + "&number=" + number+"&mobile="+mobile;
        Kd100Info kd100Info = null;
        result = HttpUtils.sendGet(url, null);
        JSONObject json = JSONObject.fromObject(result);
        if (json.getInt("status") != 0) {
            SystemError.wrapBs("500",json.getString("msg"));
        } else {
            JSONObject resultarr = (JSONObject) json.opt("result");
            kd100Info = new Kd100Info(resultarr);
        }
        return kd100Info;
    }
}
